package org.lop.modules.test.spring;

import javax.sql.DataSource;

import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.transaction.TransactionConfiguration;
import org.springframework.transaction.annotation.Transactional;

/**
 * Spring的支持数据库访问, 事务控制和依赖注入的JUnit4集成测试基类.
 * 
 * @RunWith( SpringJUnit4ClassRunner.class )
 * @ActiveProfiles( "test" )
 * @ContextConfiguration( locations = { "classpath*:/applicationContext.xml" } )
 * @TransactionConfiguration( transactionManager = "defaultTransactionManager" )
 * @Transactional
 * 
 * @author 潘瑞峥
 * @date 2012-06-15
 */
@RunWith( SpringJUnit4ClassRunner.class )
@ActiveProfiles( "test" )
@ContextConfiguration( locations = "classpath*:/applicationContext.xml" )
@TransactionConfiguration( transactionManager = "defaultTransactionManager" )
@Transactional
public abstract class SpringTransactionalTestCase {

	@Autowired
	protected DataSource dataSource;

}